<template>
  <div class="audition204">
    <p>1. 创建xhr实例</p>
    <code class="code">
      var xhr = new XMLHttpRequest()
    </code>
    <p>2. 连接服务器</p>
    <code class="code">
      xhr.open('get', url)
    </code>
    <p>3. 发送请求</p>
    <code class="code">
      xhr.send()
    </code>
    <p>4. 接收数据</p>
    <code class="code">
      xhr.onreadystatechange = function () {<br />
        <span class="indient">if(xhr.readyState === 4) {</span><br />
          <span class="indient2">console.log(xhr.responseText)</span><br />
        <span class="indient">} else {</span><br />
          <span class="indient2">console.log(xhr.status)</span><br />
        <span class="indient">}</span><br />
      }
    </code>
  </div>
</template>

<script>
export default {
  name: 'Audition204'
}
</script>

<style>

</style>